<?php

namespace App\Request\Report;

use App\Request\BaseCommonRequest;
use Hyperf\Context\Context;
use Hyperf\Validation\Request\FormRequest;

class TipOffListRequest extends BaseCommonRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'type' => 'required',
            'page' => 'required|integer|gte:1',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息
     */
    public function messages(): array
    {
        $language = Context::get('language');
        if ($language == 'zh-zn') {
            return [
                'type.required' => '類型不得為空',
                'page.required' => 'page不能为空',
                'page.integer' => 'page必须为整数',
                'page.gte' => 'page 大于等于 1',
            ];
        } elseif ($language == 'zh-hk') {
            return [
                'type.required' => '不得為空',
                'page.required' => 'page不得為空',
                'page.integer' => 'page 必須為整數',
                'page.gte' => 'page 大於等於 1',
            ];
        } else {
            return [
                'type.required' => 'type cannot be empty',
                'page.required' => 'page cannot be empty',
                'page.integer' => 'page must be an integer',
                'page.gte' => 'page must be greater than or equal to 1',
            ];
        }

    }


}